package com.boco.ibssystem.business.service.impl;

import com.boco.biinjectionserviceapi.vo.Params;
import com.boco.ibssystem.business.mapper.TbYlzlMapper;
import com.boco.ibssystem.business.service.IYlzlService;
import com.boco.ibssystem.business.vo.ResData;
import com.boco.ibssystem.business.vo.ZlzlVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@Service
public class YlzlServiceImpl implements IYlzlService {

    @Resource
    private  TbYlzlMapper tbYlzlMapper;

    @Override
    public List<ResData> kjywSyqd(Params params) {
        List<ResData> sumDDDList= tbYlzlMapper.getSumDDD(params);
        List<ResData> sumyzList =  tbYlzlMapper.getSumYZ(params);
            List<ResData> res = new ArrayList<>();
        if(sumDDDList.size()>0){
            for(int i =0;i<sumDDDList.size();i++){
                ResData data = new ResData();
                data.setKey(sumDDDList.get(i).getKey());
                data.setValue(sumDDDList.get(i).getValue()!=null?Double.parseDouble(sumDDDList.get(i).getValue().toString()):0/Double.parseDouble(sumyzList.get(i).getValue().toString()));
                res.add(data);
            }
        }
        return res;
    }

    @Override
    public List<ResData> kjywShouru(Params params) {
        return tbYlzlMapper.getMzKjywShouru(params);
    }

    @Override
    public ResData ypsrBili(Params params) {
        ResData resData = tbYlzlMapper.getYPSRBili(params);
        return resData;
    }

    @Override
    public ResData kjywSyl(Params params) {
        return tbYlzlMapper.getZyKjywZb(params);
    }

    @Override
    public ResData kjywCfb(Params params) {
        return tbYlzlMapper.getKjywCfb(params);
    }

    @Override
    public Map<String, Object> hlyySjtj(Params params) {
        return null;
    }


    @Override
    public List<ZlzlVO> cyhzPjzyr(Params params) {
        return tbYlzlMapper.getCyhzPjzyr(params);
    }

    @Override
    public List<ZlzlVO> zywjQjs(Params params) {
        return tbYlzlMapper.getZywjQjs(params);
    }

    @Override
    public ZlzlVO cyhzSszb(Params params) {
        return tbYlzlMapper.getCyhzSszb(params);
    }
}
